<template>
	<view class="pics">
		<scroll-view class="left" scroll-y>
			<view @click="leftClick(index,item.id)" :class="active===index?'active':''" v-for="(item,index) in title" :key="item.id">{{item.title}}</view>
		</scroll-view>
		
		<view class="right">
			
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				title:[],
				active: 0
			}
		},
		onLoad() {
			this.getfenlei()
		},
		methods: {
			getfenlei(){
				uni.request({
					url:'http://127.0.0.1:5500/api/shop/fenlei.json',
					success:res => {
						this.title = res.data.message
					}
				})
			},
			leftClick(index,id){
				this.active = index
			}
		}
	}
</script>

<style lang="scss">
	page{
		height: 100%;
	}
	.pics{
		height: 100%;
		.left{
			width: 200rpx;
			height: 100%;
			border-right: 1px solid #eee;
			view{
				height: 45px;
				line-height: 45px;
				text-align: center;
				font-size: 35rpx;
				color: #333;
				border-bottom: 1px solid #eee;
			}
			.active{
				background: #ff3366;
				color: #fff;
			}
		}
	}
</style>
